package main

import "fmt"

func main() {

	intChan2 := make(chan int, 100)

	// fatal error: all goroutines are asleep - deadlock!
	//for i := range intChan2 {
	//	intChan2 <- i*2
	//}

	//for i := 0; i < len(intChan2); i++ {
	//	intChan2 <- i*2
	//}

	for i := 0; i < 100; i++ {
		intChan2 <- i * 2
	}

	// fatal error: all goroutines are asleep - deadlock!
	close(intChan2)

	for v := range intChan2 {
		fmt.Println("v=", v)
	}
}
